﻿using BW.MesProject.Public.Application;
using BW.MesProject.Public.Application.Dto.Input;
using BW.MesProject.Public.Application.Dto.Output;
using BW.MesProject.Public.ErrorCode;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BW.MesProject.Public.Host.Controllers
{
    /// <summary>
    /// 用户管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly IUserServices _userServices;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userServices">用户仓储</param>
        public UserController(IUserServices userServices)
        {
            this._userServices = userServices;
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<UserLoginOutput> UserLogin([FromBody]UserLoginInput input)
        {
            return _userServices.UserLogin(input);
        }
    }
}
